﻿CREATE FUNCTION [dbo].[NextMenus]
(@MenuID int,@Direction int = 0)
RETURNS TABLE
AS
RETURN(
SELECT DISTINCT TOP 100 PERCENT vsec_WorkFlow.NextWFIndex, vsec_WorkFlow.NextMenuID, vsec_WorkFlow.NextMenuName, vsec_WorkFlow.Direction
FROM vsec_WorkFlow
WHERE MenuID = @MenuID AND @Direction IN (Direction, 0)
ORDER BY NextWFIndex
)

